<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 15-8-10
 * Time: 下午2:04
 */
class PageLibModel extends MY_Model {
    /*获取信息总数*/
    public function getNum($table, $where = array()){
        $sqlInfo = array(
            'fields' => array(
                'count(*) as num',
            ),
            'table' => $table,
            'where' => $where,
        );

        $list = $this->CoreSelect($sqlInfo);
        return empty($list[0])?0:$list[0]->num;
    }

    /*获取当前页信息列表*/
    public function getList($table, $where = array(), $page = 1, $perPage = 20, $fields = array('*')){
        $sqlInfo = array(
            'fields' => $fields,
            'table' => $table,
            'where' => $where,
            'order' => array(
                'last_update desc,add_time desc'
            ),
            'limit' => ($page - 1) * $perPage . ',' . $perPage,
        );

        $list = $this->CoreSelect($sqlInfo);
        return empty($list)?array():$list;
    }
}

/* End of file expresslibmodel.php */
/* Location: ./application/model/lib/expresslibmodel.php */